package algoWing42.vista;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;

import algoWing42.controlador.AccionBotonCargar;
import algoWing42.controlador.AccionBotonCreditos;
import algoWing42.controlador.AccionBotonJugar;

import java.awt.Color;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.event.KeyEvent;
import java.awt.Font;
import javax.swing.SwingConstants;

/**
 * esta clase corresponde al menu principal del juego.
 * 
 * */
public class MenuPrincipal extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JButton jugar = null;
	private JButton cargar = null;
	private JButton creditos = null;
	private JButton salir = null;
	private JLabel labelSuperior = null;

	/**
	 * This is the default constructor
	 */
	public MenuPrincipal() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(576, 383);
		this.setContentPane(getJContentPane());
		this.setTitle("JuegoAlgoWing42");

	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			labelSuperior = new JLabel();
			labelSuperior.setBounds(new Rectangle(0, 0, 573, 71));
			labelSuperior.setText("Algo Wing 42");
			labelSuperior.setForeground(Color.white);
			labelSuperior.setBackground(Color.black);
			labelSuperior.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
			labelSuperior.setFont(new Font("Comic Sans MS", Font.BOLD, 36));
			labelSuperior.setHorizontalAlignment(SwingConstants.CENTER);
			labelSuperior.setHorizontalTextPosition(SwingConstants.CENTER);
			labelSuperior.setOpaque(true);
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJugar(), null);
			jContentPane.add(getCargar(), null);
			jContentPane.add(getCreditos(), null);
			jContentPane.add(getSalir(), null);

			jContentPane.add(labelSuperior, null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jugar
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJugar() {
		if (jugar == null) {
			jugar = new JButton();
			jugar.setBounds(new Rectangle(181, 82, 124, 44));
			jugar.setText("Jugar");
			jugar.addActionListener(new AccionBotonJugar(this));

		}
		return jugar;
	}

	/**
	 * This method initializes cargar
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getCargar() {
		if (cargar == null) {
			cargar = new JButton();
			cargar.setBounds(new Rectangle(181, 147, 124, 44));
			cargar.setText("Cargar");
			cargar.addActionListener(new AccionBotonCargar(this));

		}
		return cargar;
	}

	/**
	 * This method initializes Creditos
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getCreditos() {
		if (creditos == null) {
			creditos = new JButton();
			creditos.setBounds(new Rectangle(181, 209, 124, 44));
			creditos.setText("Creditos");
			creditos.addActionListener(new AccionBotonCreditos(this));

		}
		return creditos;
	}

	/**
	 * This method initializes salir
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getSalir() {
		if (salir == null) {
			salir = new JButton();
			salir.setBounds(new Rectangle(414, 289, 124, 44));
			salir.setText("salir");
			salir.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.exit(0);
				}
			});
		}
		return salir;
	}

}
